package chapter3.quarter3;

import java.text.DecimalFormat;
import java.util.Scanner;

public class IntDouble {
    public static void main(String[] args) {
        int age;
        double weight,height,bmi;
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入年龄：");
        age=scanner.nextInt();
        System.out.println("请输入体重（公斤）：");
        weight=scanner.nextDouble();
        System.out.println("请输入身高（米）：");
        height=scanner.nextDouble();
        bmi=weight/(height*height);
        DecimalFormat fmt=new DecimalFormat("0.###");
        System.out.println("BMI:"+fmt.format(bmi));
        fmt=new DecimalFormat("0.##");//四舍五入
        System.out.println("BMI:"+fmt.format(bmi));

    }
}
